(1) Field of the Invention
The present invention relates to moving picture coding apparatuses, moving picture coding methods, and moving picture imaging apparatuses for coding moving pictures. In particular, the present invention relates to a technique to determine quantizer scales used in quantizing data of the moving pictures.
(2) Description of the Related Art
Generally, a moving picture imaging apparatus is equipped with a moving picture coding apparatus for compressing data of moving pictures taken with the moving picture imaging apparatus. Such a moving picture coding apparatus compresses the data by quantization. Quantization is a method to compress data by replacing data values with discrete representative values. Intervals between the representative values are defined by a parameter called a quantizer scale. As the quantizer scale becomes greater, the compression rate becomes higher (i.e. a code size becomes smaller).
According to an example of conventional models of moving picture coding apparatuses, a fixed value is used as a quantizer scale for a frame to be intra-coded (so called I picture) to determine a different quantizer scale for each of frames to be inter-coded (so called P picture or B picture) (See ISO/IEC-14496-2 for example). In order to determine the quantizer scales for the frames to be inter-coded, a formula 1 below is used.Qp[n+1]=(Cn/dstC)*Qp[n]  Formula 1
In this formula, Qp[n] is a quantizer scale used in quantization of a frame n, Cn is an amount of codes generated in the frame n, and dstC is a target amount of codes to be generated that is predetermined for one frame.
According to the formula 1, a quantizer scale Qp[n+1] for a frame (n+1) becomes larger as the amount of codes Cn generated in the frame n to the target amount of codes dstC becomes larger.
The formula 1 works in a manner so as to suppress an amount of codes to be generated in the frame (n+1). By determining the quantizer scale in the above manner for each frame, it is possible for the moving picture coding apparatus to adaptively bring the amount of codes generated in the inter-coded frame closer to the amount of codes generated to the target amount of codes.
Because an amount of codes generated in an intra-coded frame affects image quality to a large extent, a quantizer scale for a frame to be intra-coded is generally determined so that the amount of codes generated in these frames becomes larger than the target amount of codes. In this case, the above moving picture coding apparatus tries to suppress an amount of codes generated in a frame 2 that comes immediately after the intra-coded frame (frame 1). As a result, the amount of codes generated in the frame 2 becomes much smaller than the target amount of codes. Then, the moving picture coding apparatus tries to make an amount of codes generated in a frame 3 larger than the target amount of codes. As explained above, with conventional moving picture coding apparatuses, hunting in the amounts of codes generated in several frames immediately after the intra-coded frame occurs.
FIG. 1 show diagrams showing shifts of an amount of codes generated in each frame and image quality in a conventional moving picture coding apparatus.
In this example, frames 1, 11, and 21 are intra-coded frames, and the rest of the frames are inter-coded frames. In this figure, the hunting in the amount of generated codes as described above can be observed in four frames immediately after each intra-coded frame (FIG. 1A).
In general, the image quality improves more, as the amount of generated codes increases. Therefore, the hunting in the amount of generated codes makes the image quality unstable (FIG. 1B). As a result, the images become unsightly.
Such a problem is not limited to the models that determines quantizer scales for each frame, and can also be observed in models that determines quantizer scales for each block line (a line of macro blocks that are positioned in matrix in an image).